// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLName;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.ast.expr.SQLLiteralExpr;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "MySqlLoadXmlStatement.h"
#include "../../../../ast/SQLExpr.h"
#include "../../../../ast/SQLName.h"
#include "../../../../ast/SQLObject.h"
#include "../../../../ast/expr/SQLLiteralExpr.h"
#include "../../visitor/MySqlASTVisitor.h"
#include "../../../../../utils/listTran.h"

MySqlLoadXmlStatement::MySqlLoadXmlStatement()
{
  setList = std::make_shared<std::list<SQLExpr_ptr>>();
}
SQLExpr_ptr MySqlLoadXmlStatement::getRowsIdentifiedBy()
{
  return rowsIdentifiedBy;
}

void MySqlLoadXmlStatement::setRowsIdentifiedBy(SQLExpr_ptr rowsIdentifiedBy)
{
  this->rowsIdentifiedBy = rowsIdentifiedBy;
}

BOOL_ptr MySqlLoadXmlStatement::isLowPriority()
{
  return lowPriority;
}

void MySqlLoadXmlStatement::setLowPriority(BOOL_ptr lowPriority)
{
  this->lowPriority = lowPriority;
}

BOOL_ptr MySqlLoadXmlStatement::isConcurrent()
{
  return concurrent;
}

void MySqlLoadXmlStatement::setConcurrent(BOOL_ptr concurrent)
{
  this->concurrent = concurrent;
}

BOOL_ptr MySqlLoadXmlStatement::isLocal()
{
  return local;
}

void MySqlLoadXmlStatement::setLocal(BOOL_ptr local)
{
  this->local = local;
}

SQLLiteralExpr_ptr MySqlLoadXmlStatement::getFileName()
{
  return fileName;
}

void MySqlLoadXmlStatement::setFileName(SQLLiteralExpr_ptr fileName)
{
  this->fileName = fileName;
}

BOOL_ptr MySqlLoadXmlStatement::isReplicate()
{
  return replicate;
}

void MySqlLoadXmlStatement::setReplicate(BOOL_ptr replicate)
{
  this->replicate = replicate;
}

BOOL_ptr MySqlLoadXmlStatement::isIgnore()
{
  return ignore;
}

void MySqlLoadXmlStatement::setIgnore(BOOL_ptr ignore)
{
  this->ignore = ignore;
}

SQLName_ptr MySqlLoadXmlStatement::getTableName()
{
  return tableName;
}

void MySqlLoadXmlStatement::setTableName(SQLName_ptr tableName)
{
  this->tableName = tableName;
}

string_ptr MySqlLoadXmlStatement::getCharset()
{
  return charset;
}

void MySqlLoadXmlStatement::setCharset(string_ptr charset)
{
  this->charset = charset;
}

SQLExpr_ptr MySqlLoadXmlStatement::getIgnoreLinesNumber()
{
  return ignoreLinesNumber;
}

void MySqlLoadXmlStatement::setIgnoreLinesNumber(SQLExpr_ptr ignoreLinesNumber)
{
  this->ignoreLinesNumber = ignoreLinesNumber;
}

SQLExpr_list_ptr MySqlLoadXmlStatement::getSetList()
{
  return setList;
}

void MySqlLoadXmlStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlLoadXmlStatement)))
  {
    acceptChild(visitor, fileName);
    acceptChild(visitor, tableName);
    acceptChild(visitor, rowsIdentifiedBy);
    // acceptChild(visitor, columnsTerminatedBy);
    // acceptChild(visitor, columnsEnclosedBy);
    // acceptChild(visitor, columnsEscaped);
    // acceptChild(visitor, linesStartingBy);
    // acceptChild(visitor, linesTerminatedBy);
    acceptChild(visitor, ignoreLinesNumber);
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLExpr, SQLObject>(setList);
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlLoadXmlStatement));
}

// @Override
SQLObject_list_ptr MySqlLoadXmlStatement::getChildren()
{
  SQLObject_list_ptr children = std::make_shared<std::list<SQLObject_ptr>>();
  if (fileName != nullptr)
  {
    children->push_back(fileName);
  }
  if (tableName != nullptr)
  {
    children->push_back(tableName);
  }
  if (rowsIdentifiedBy != nullptr)
  {
    children->push_back(rowsIdentifiedBy);
  }
  if (ignoreLinesNumber != nullptr)
  {
    children->push_back(ignoreLinesNumber);
  }
  // children.addAll(this->setList);
  for (auto it : *this->setList)
  {
    children->push_back(it);
  }
  return children;
}
